<?php

class Application_Model_DbTable_CEPs extends Zend_Db_Table_Abstract
{

    protected $_name = 'ceps';

    public function getCEP($cep_no)
    {
    	$cep_no = (int)$cep_no;
    	$row = $this->fetchRow('cep_no = ' . $cep_no);
    	if (!$row) {
    		throw new Exception("Could not find row $cep_no");
    	}
    	return $row->toArray();
    }
    
    public function addCEP($cep_date, $cep_description, $staff_no, $prod_no, $prod_description, $cust_no, $dep_no)
    {
    	
    	$data = array(
    		'cep_date' => $cep_date,
    		'cep_description' => $cep_description,
    		'staff_no' => $staff_no,
    		'prod_no' => $prod_no,
    		'prod_description'=>$prod_description,
    		'cust_no'=> $cust_no,
    		'dep_no'=> $dep_no
    	);
    	$this->insert($data);
    }

    
    public function searchCEP($cep_no, $cep_description, $prod_no, $staff_no, $cust_no, $dep_no)
    {
    	$data = array(
        		'cep_no' => $cep_no,
        		'cep_description' => $cep_description,
        		'staff_no' => $staff_no,
        		'cust_no' => $cust_no,
        		'dep_no' => $dep_no
    	);
    }
    
    public function deleteCEP($cep_no)
    {
    	$this->delete('cep_no = '. (int)$cep_no);
    }
}

